package net.csdn.business.notify.handler.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.csdn.business.notify.common.mapper.NotifyUserSettingMapper;
import net.csdn.business.notify.common.model.dto.NewNotifyUserSettingDTO;
import net.csdn.business.notify.common.model.dto.UpdateNotifyUserSettingDTO;
import net.csdn.business.notify.common.model.entity.NotifyUserSetting;
import net.csdn.business.notify.common.model.query.NotifyUserSettingQuery;
import net.csdn.business.notify.common.model.vo.NotifyUserSettingVO;
import net.csdn.business.notify.handler.service.INotifyUserSettingService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 通知中心-用户通知配置Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-11-27
 */
@Service
public class NotifyUserSettingServiceImpl extends ServiceImpl<NotifyUserSettingMapper, NotifyUserSetting> implements INotifyUserSettingService
{

    /**
     * 分页查询通知中心-用户通知配置列表
     *
     * @param query 通知中心-用户通知配置
     * @return 通知中心-用户通知配置
     */
    @Override
    public Page<NotifyUserSettingVO> findPageList(NotifyUserSettingQuery query) {
        //获得Page对象
        Page<NotifyUserSettingVO> page = query.getPage();
        List<NotifyUserSettingVO> pageList=baseMapper.findPageList(page,query);
        page.setRecords(pageList);
        return page;
    }

    /**
     * 根据id查询通知中心-用户通知配置
     * 
     * @param id 通知中心-用户通知配置主键
     * @return 通知中心-用户通知配置
     */
    @Override
    public NotifyUserSettingVO selectNotifyUserSettingById(String id)
    {
        return baseMapper.selectNotifyUserSettingById(id);
    }

    /**
     * 查询通知中心-用户通知配置列表
     * 
     * @param query 通知中心-用户通知配置
     * @return 通知中心-用户通知配置
     */
    @Override
    public List<NotifyUserSettingVO> selectNotifyUserSettingList(NotifyUserSettingQuery query)
    {
        return baseMapper.selectNotifyUserSettingList(query);
    }

    /**
     * 新增通知中心-用户通知配置
     *
     * @param newNotifyUserSettingDTO 通知中心-用户通知配置
     * @return 结果
     */
    @Override
    public Integer insertNotifyUserSetting(NewNotifyUserSettingDTO newNotifyUserSettingDTO)
    {
        NotifyUserSetting notifyUserSetting=new NotifyUserSetting();
        BeanUtils.copyProperties(newNotifyUserSettingDTO,notifyUserSetting);
        return baseMapper.insertNotifyUserSetting(notifyUserSetting);
    }

    /**
     * 修改通知中心-用户通知配置
     *
     * @param updateNotifyUserSettingDTO 通知中心-用户通知配置
     * @return 结果
     */
    @Override
    public Integer updateNotifyUserSetting(UpdateNotifyUserSettingDTO updateNotifyUserSettingDTO)
    {
        NotifyUserSetting notifyUserSetting=new NotifyUserSetting();
        BeanUtils.copyProperties(updateNotifyUserSettingDTO,notifyUserSetting);
        return baseMapper.updateNotifyUserSetting(notifyUserSetting);
    }

    /**
     * 删除通知中心-用户通知配置信息
     * 
     * @param id 通知中心-用户通知配置主键
     * @return 结果
     */
    @Override
    public Integer deleteNotifyUserSettingById(String id)
    {
        return baseMapper.deleteNotifyUserSettingById(id);
    }

    @Override
    public List<NotifyUserSettingVO> batchQuery(NotifyUserSettingQuery query) {
        return baseMapper.batchQuery(query);
    }

    @Override
    public NotifyUserSettingVO selectNotifyUserSetting(String targetType,String act,String userId) {
        return baseMapper.selectNotifyUserSetting(targetType,act,userId);
    }
}
